package com.lyy.config;

import org.apache.commons.dbutils.QueryRunner;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.*;

import javax.sql.DataSource;

/**
 * 纯注解配置时的spring配置类
 */
@Configuration
@ComponentScan(value = "com.lyy")
@Import(JdbcConfiguration.class)
@EnableAspectJAutoProxy//开启对注解aop的支持
public class SpringConfiguration {
    /**
     * 创建 common-dbutils的核心对象
     * @return
     */
    @Bean(name="queryRunner")
    public QueryRunner createQueryRunner(@Qualifier("dataSource") DataSource dataSource){
        return new QueryRunner(dataSource);
    }
}
